package com.bbcare.followup.plat.service.impl;

import com.bbcare.followup.plat.entity.PtUserInfoCollect;
import com.bbcare.followup.plat.service.IPtUserInfoCollectService;
import com.bbcare.followup.plat.store.ibatis.IPtUserInfoCollectDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Title		PtUserInfoCollectServiceImpl.java
 * @Package		com.bbcare.followup.plat.service.impl
 * @Description	患者建档信息表
 * @Author		<a href="mailto:jiangqian_java@163.com">jiang</a>
 * @Date		2023/9/11
 * @Version		V1.0 
 * @Copyright	(c) Shanghai BBcare Medical Equipment Co.,Ltd.
 */
@Service
public class PtUserInfoCollectService implements IPtUserInfoCollectService {

    @Resource
    private IPtUserInfoCollectDao ptUserInfoCollectDao;


    @Override
    public Object insert(PtUserInfoCollect ptUserInfoCollect) {

        // valid
        if (ptUserInfoCollect == null) {
            return ("必要参数缺失");
        }

        return ptUserInfoCollectDao.insert(ptUserInfoCollect);
    }


    @Override
    public Object delete(int id) {
        return ptUserInfoCollectDao.delete(id);
    }


    @Override
    public Object update(PtUserInfoCollect ptUserInfoCollect) {
        return ptUserInfoCollectDao.update(ptUserInfoCollect);
    }


    @Override
    public PtUserInfoCollect load(int id) {
        return ptUserInfoCollectDao.load(id);
    }


    @Override
    public Map<String,Object> pageList(int offset, int pagesize) {

        List<PtUserInfoCollect> pageList = ptUserInfoCollectDao.pageList(offset, pagesize);
        int totalCount = ptUserInfoCollectDao.pageListCount(offset, pagesize);

        // result
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("pageList", pageList);
        result.put("totalCount", totalCount);

        return result;
    }

    @Override
    public List<PtUserInfoCollect> getDataByCondition(PtUserInfoCollect ptUserInfoCollect) {
        return ptUserInfoCollectDao.getDataByCondition(ptUserInfoCollect);
    }
}
